#include "LoginSession.h"
#include "Login.h"
LoginSession::LoginSession(xSocket* sock)
             : xTCPTask{sock}
{
}

void LoginSession:: Online()
{

}
void LoginSession:: Offline()
{

}

void LoginSession::AddSession(xTCPTask* task)
{
    LoginMgr.AddSession(task);
}

bool LoginSession::Update(uint32 diff)
{
    DataPacket* pack = nullptr;
    while((pack = GetRecvPacketQue().Pop()) != nullptr)
    {
        HandleDataPacket(pack);
    }

    if(IsClose())
    {
        Offline();
        return false;
    }
    return true;
}

bool LoginSession::VaildOpCode(uint16 opcode)
{
    return true;
}

bool LoginSession::HandleDataPacket(DataPacket* pack)
{

    DELETE(pack);
    return true;
}
